package org.bootstrap.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.bootstrap.entity.WorkType;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;

@Mapper
public interface ListMapper {

    LinkedList<HashMap<String, Object>> get_detail(HashMap<String, Object> map);

    LinkedList<HashMap<String, Object>> get_sel_options();

    int push(HashMap<String, Object> _form);

    ArrayList<String> get_assign(ArrayList<String> account);

    @Select("SELECT COUNT(id) FROM  pq_sys.pq_table_main WHERE menu_id =#{id}")
    int get_list_count_by_id(String id);

    @Update("UPDATE pq_sys.pq_table_main SET content_id = #{docId} WHERE self_id = #{list_id}")
    int modify_content_id(@Param("docId") String docId, @Param("list_id") String list_id);

    @Select("SELECT id, name FROM pq_sys.pq_work_type WHERE name IS NOT NULL")
    ArrayList<WorkType> get_children_work_type();

    int add_children(HashMap<String, Object> map); // 返回添加条数

    @Select("SELECT content_id FROM pq_sys.pq_table_main WHERE self_id =#{listId} LIMIT 1")
    String hasUniqueId(@Param("listId") String listId);

    HashMap<String, Object> query_children(@Param("id") String id);
}
